<template>
  <!-- 清算账户日报表查询明细页面弹出框-->
  <el-dialog
    title="清算账户日报表查询明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="false"
    @close="closeFn"
  >
    <div class="print-content" ref="printContent">
      <el-form ref="detailsForm" :model="detailsForm" label-width="150px" :disabled="true">
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="CPG日期：" prop="vdate">
              <el-date-picker
                v-model="detailsForm.vdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="工作日期：" prop="workdate">
              <el-date-picker
                v-model="detailsForm.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="日初余额：" prop="initAmt">
              <el-input v-model="detailsForm.initAmt" placeholder="日初余额"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="本日借方发生总额：" prop="dbitAmt">
              <el-input v-model="detailsForm.dbitAmt" placeholder="本日借方发生总额"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本日贷方发生总额：" prop="crdtAmt">
              <el-input v-model="detailsForm.crdtAmt" placeholder="本日贷方发生总额"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="日终余额：" prop="finalAmt">
              <el-input v-model="detailsForm.finalAmt" placeholder="日终余额"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="明细数目：" prop="txnNum">
              <el-input v-model="detailsForm.txnNum" placeholder="明细数目"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="报文接收时间：" prop="rcvTime">
              <el-date-picker
                v-model="detailsForm.rcvTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="选择时间"
                style="width: 100%;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div style="height: 300px;margin-bottom: 20px">
        <ht-table
          id="pagetable"
          ref="flowTable"
          :showSerialNumber="false"
          :multi-select="false"
          :dictMap="dictMap"
          :reqConfig="reqConfig"
          :queryParams="queryParams"
          :tableBindColumns="tableBindColumns"
          :opButtonList="opButtonList"
          :randomRowKey="true"
          :initData="false"
          defaultEventKey="flowTable"
          style="height: 100%"
        ></ht-table>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="warning" @click="printFn">打印</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { detailTabSearch } from "@/api/cnaps/saps/otherCommQuery/clear_account_query.js";
import { window } from "d3-selection";
export default {
  name: "AccountDetails",
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    detailsForm: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      reqConfig: detailTabSearch,
      // 查询参数
      queryParams: {
        id: "",
      },
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `业务分类`,
          prop: "txnType",
          align: "center",
          dictCode: "TXN_TYPE",
          sortable: false,
          width: "150",
        },
        {
          label: `本日借方发生额`,
          prop: "dtlDbitAmt",
          align: "center",
          sortable: false,
        },
        {
          label: `本日贷方发生额`,
          prop: "dtlCrdtAmt",
          align: "center",
          sortable: false,
        },
      ],
    };
  },
  mounted() {},
  watch: {
    open(d) {
      if (d) {
        this.$nextTick(() => {
          if (this.detailsForm && this.detailsForm.id) {
            this.$set(this.queryParams, "id", this.detailsForm.id);
            this.$refs.flowTable.doQuery();
          }
        });
      }
    },
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
    printFn() {
      this.$print(this.$refs["printContent"]);
    },
  },
};
</script>
<style lang="scss" scoped>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
::v-deep table {
  table-layout: auto !important;
}
::v-deep .el-table__header-wrapper .el-table__header {
  width: 100% !important;
}
::v-deep .el-table__body-wrapper .el-table__body {
  width: 100% !important;
}
::v-deep #pagetable table {
  table-layout: fixed !important;
}
@page {
  size: 297mm 210mm;
  margin: 0;
}
@media print {
  ::-webkit-scrollbar {
    display: none;
  }
  .print-dialog {
    overflow: hidden !important;
  }
  .print-content {
    width: 1000px;
    margin: 50px auto;
    .app-container-footer {
      display: none;
    }
  }
  #pagetable {
    ::v-deep .app-container-footer {
      display: none !important;
    }
  }
}
</style>
